package com.yodawnla.littleWar.player;

import java.util.ArrayList;

import com.yodawnla.lib.util.YoInt;
import com.yodawnla.littleWar.card.Deck;
import com.yodawnla.littleWar.card.HandCard;
import com.yodawnla.littleWar.card.HeroCard;
import com.yodawnla.littleWar.map.Location;

public class Player
{
	YoInt mGold;
	Deck mDeck;
	YoInt mHeroCardMaxSpace = new YoInt(54);
	YoInt mHandCardMaxSpace = new YoInt(54);
	ArrayList<HeroCard> mHeroCardList = new ArrayList<HeroCard>();
	ArrayList<HandCard> mHandCardList = new ArrayList<HandCard>();
	
	Location mCurrentBattleLocation;
	int mSide;
	
	static Player instance = null;
	
	public static Player getInstance()
	{
		if (instance == null)
			instance = new Player();
		return instance;
	}
	
	Player(){}
	
	public int getHeroCardSize()
	{
		return mHeroCardList.size();
	}
	
	public int getHandCardSize()
	{
		return mHandCardList.size();
	}
	
	public HeroCard getHeroCard(int index)
	{
		return mHeroCardList.get(index);
	}
	
	public HandCard getHandCard(int index)
	{
		return mHandCardList.get(index);
	}
	
	public void loadHeroCardList(String data)
	{
		
	}
	
	public void loadHandCardList(String data)
	{
		
	}
	
	public void setCurrentBattleLocation(Location location)
	{
		mCurrentBattleLocation = location;
	}
	
	public void setSide(int side)
	{
		mSide = side;
	}
	
	public int getCurrentBattleLocationID()
	{
		if (mCurrentBattleLocation == null)
			return -1;
		return mCurrentBattleLocation.getID();
	}
	
	public int getSide()
	{
		return mSide;
	}
	
	public void addHeroCard(HeroCard card)
	{
		mHeroCardList.add(card);
	}
	
	public void removeHeroCard(HeroCard card)
	{
		mHeroCardList.remove(card);
	}
	
	public void addHandCard(HandCard card)
	{
		mHandCardList.add(card);
	}
	
	public void removeHandCard(HandCard card)
	{
		mHandCardList.remove(card);
	}
	
	public int getHeroCardMaxSpace()
	{
		return mHeroCardMaxSpace.get();
	}
	
	public int getHandCardMaxSpace()
	{
		return mHandCardMaxSpace.get();
	}
	
	public void setDeck(Deck deck)
	{
		mDeck = deck;
		mDeck.setIsPlayer(true);
		mDeck.init();
	}
	
	public Deck getDeck()
	{
		return mDeck;
	}
	
	public int getGold()
	{
		return mGold.get();
	}
}